package com.daifeng.gulimall.product.web;

import com.daifeng.gulimall.product.service.SpuInfoService;
import com.daifeng.gulimall.product.vo.SkuItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ItemRooterController {

    @Autowired
    SpuInfoService spuInfoService;

    /**
     * 获取商品详情
     * @param skuid
     * @param model
     * @return
     */
    @RequestMapping("/{skuid}.html")
    public String item(@PathVariable Long skuid,Model model){
        SkuItemVo info =  spuInfoService.item(skuid);
        model.addAttribute("info",info);
        System.out.println(info);
        return "item";
    }


}
